<template>
	<div class="report">
		<h4>举报描述</h4>
		<textarea name="" placeholder="请您简单描述举报内容（50字以内）" v-model="content"></textarea>
		<div class="prevStep" @click="lastStep"></div>
		<div class="subBtn" @click="send"></div>
		<bottom-nav></bottom-nav>
	</div>
</template>

<script>
	import bottomNav from './bottomNav'
	import router from '../router'
	import _ from 'lodash'
	export default {
		name: 'carry',
		data () {
			return {
                carryHeight: 0,
                picked:'',
                content:'',
                userInfo:''
			}
		},
		components: {bottomNav},
		mounted () {

			var str = window.location.href ;
			this.picked = str.charAt(str.length-1);
			this.userInfo = JSON.parse(window.localStorage.getItem("userInfo"));

		},
		created() {
            this.init();
		},
		methods: {
			init () {
				this.carryHeight = (document.documentElement.clientHeight - document.documentElement.clientHeight/750*4.9*10);			
			},
			send (){
	     	   this.axios({
					method: 'POST',
					url: 'http://xyydj.daoapp.io/mobile/advises?openid='+this.userInfo.openid,
					data: {
						 type: this.picked,
						 content: _.trim(this.content)
						}
				}).then(function(res){
					if(res.status == 200){
						// console.log("ok");
						router.push({"path":"/"})
					}
				}).catch(function(err){
						console.log(err)
				})
			},
			lastStep(){
				router.push("/page4");
			}
		}
	}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.report{padding: 1.7rem 1.9rem;width: 100%;box-sizing: border-box;}
.report h4{font-size: 1.5rem;color: #000;font-weight: normal;}
.report textarea{margin-top: 1.2rem;padding: .5rem;box-shadow: 0px 1px 5px #ddd;width: 100%;resize: none;height: 16.4rem;border-radius: 6px;border: 1px solid #dfdfdf;box-sizing: border-box;}
.prevStep{margin: 3rem auto 0;background: url(../assets/img/prevStep.png) center no-repeat;width: 16.65rem;height: 3.5rem;background-size: auto 3.5rem;}
.subBtn{margin: 2rem auto 0;background: url(../assets/img/subBtn1.png) center no-repeat;background-size: auto 3.5rem;width: 16.65rem;height: 3.5rem;}
</style>
